package com.ethink.system.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ethink.system.api.info.SystemUserInfo;
import com.ethink.system.api.info.SystemUserSessionInfo;
import com.ethink.system.api.request.SystemUserAddRequest;
import com.ethink.system.api.request.SystemUserListRequest;
import com.ethink.system.api.request.SystemUserQueryRequest;
import com.ethink.system.api.request.SystemUserUpdateRequest;
import com.ethink.system.api.response.SystemUserAddResponse;
import com.ethink.system.api.response.SystemUserDeleteResponse;
import com.ethink.system.api.response.SystemUserDetailResponse;
import com.ethink.system.api.response.SystemUserUpdateResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 系统用户表 Facade接口
 *
 * @author default
 * @date 2022-09-26
 */
@FeignClient(name = "ethink-system-service", path = "system-service/facade/v1/systemUser", contextId = "systemUserFacade")
public interface SystemUserFacade {

    @PostMapping("/querySystemUser")
    @ResponseBody
    Page<SystemUserInfo> querySystemUser(@RequestBody SystemUserQueryRequest request);

    @GetMapping("/getSystemUserById")
    @ResponseBody
    SystemUserDetailResponse getSystemUserById(@RequestParam("systemUserId") Long systemUserId);

    @PostMapping("/listSystemUser")
    @ResponseBody
    List<SystemUserInfo> listSystemUser(@RequestBody SystemUserListRequest request);

    @PostMapping("/addSystemUser")
    @ResponseBody
    SystemUserAddResponse addSystemUser(@RequestBody SystemUserAddRequest request);

    @PostMapping("/updateSystemUser")
    @ResponseBody
    SystemUserUpdateResponse updateSystemUser(@RequestBody SystemUserUpdateRequest request);

    @PostMapping("/deleteSystemUser")
    @ResponseBody
    SystemUserDeleteResponse deleteSystemUser(@RequestParam("systemUserId") Long systemUserId);

    @PostMapping("/getSystemUserSession")
    @ResponseBody
    SystemUserSessionInfo getSystemUserSession(@RequestParam("loginName") String loginName);

    @PostMapping("/loginByAccessToken")
    @ResponseBody
    SystemUserSessionInfo loginByAccessToken(@RequestParam("token") String token);
}